import { ElNotification, ElMessageBox } from "element-plus"
import nprogress from 'nprogress'


// 提示信息
export function toast(msg, type='success', duration=3000, dangerouslyUseHTMLString=true){
    ElNotification({
        message: msg,
        type: type,
        duration: duration,
        dangerouslyUseHTMLString: dangerouslyUseHTMLString,
        position:'bottom-right'
    })
}


// 弹出框
export function showModal(content='提示内容', type='warning', title=''){
    return ElMessageBox.confirm(
        content,
        title,
        {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: type,
        }
    )
}


// 弹出输入框
export function showPrompt(tip,value){
    return ElMessageBox.prompt(tip, '', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        inputValue: value
    })
}


// 显示全局loading 
export function showFullLoading(){
    nprogress.start()
}


// 隐藏全局loading
export function hideFullLoading(){
    nprogress.done()
}
